package uk.ac.glasgow.demosocs.impl.ui;

import uk.ac.glasgow.clui.ArgumentsDescription;
import uk.ac.glasgow.clui.CommandDescription;
import uk.ac.glasgow.clui.MinimumArguments;
import uk.ac.glasgow.clui.SystemCommand;
import uk.ac.glasgow.clui.SystemCommandException;
import uk.ac.glasgow.demosocs.VotingSystem;

@MinimumArguments(0)
@CommandDescription("Sets the currently selected user.")
@ArgumentsDescription("None")
public class LogoutCommand extends SystemCommand<VotingSystem> {

	
	public LogoutCommand(VotingSystem facade) {
		super(facade);
	}

	@Override
	public String processCommand(String[] arguments)
			throws SystemCommandException {
		
		// This is the message the user will see when logs out; this will
		// force the loginMenu to be displayed and ask for a new user to 
		// login
		String logoutMenu = "-----------------------------------------\n" +
	   	        			"| Successfully logged out.              |\n" +
	   	        			"-----------------------------------------\n" ;
		System.out.println(logoutMenu);
		
		// When the user runs the application this is the first menu
		// he will encounter; this will set the current user to the 
		// new user
		String loginMenu = "-----------------------------------------\n" +
			   	   		   "| Login to the Voting System CLI        |\n" +
			   	   		   "-----------------------------------------\n" +
			   	   		   "| user <username> <password>            |\n" +
			   	   		   "-----------------------------------------" ;
		System.out.println(loginMenu);
				
		return "\n";
	}
}
